import axios from "axios";
import config from "./config";
import { GET_SITEMAP_INFO } from "./interface";

// 排除路由
export const excludeRoutes = [
  "/404",
  "/my/nickname",
  "/my/password",
  "/my/phone",
  "/my/review",
  "/questions/add",
  "/my/info",
  "/my/focus",
  "/my/book",
  "/map/location",
  "/inquire/success",
  "/inquire/result",
  "/hospital/success",
  "/hospital/evaluate",
  "/hospital/doctor",
];

// 默认路由
export const defaultRoutes = [
  {
    url: "/home",
    changefreq: "always",
    lastmod: new Date(),
  },
  {
    url: "/hospital",
    changefreq: "always",
    lastmod: new Date(),
  },
  {
    url: "/doctor",
    changefreq: "always",
    lastmod: new Date(),
  },
  {
    url: "/shop",
    changefreq: "always",
    lastmod: new Date(),
  },
  {
    url: "/my",
    changefreq: "always",
    lastmod: new Date(),
  },
  {
    url: "/my/about",
    changefreq: "always",
    lastmod: new Date(),
  },
  {
    url: "/my/join",
    changefreq: "always",
    lastmod: new Date(),
  },
  {
    url: "/questions/list",
    changefreq: "always",
    lastmod: new Date(),
  },
  {
    url: "/inquire/price",
    changefreq: "always",
    lastmod: new Date(),
  },
  {
    url: "/inquire/certification",
    changefreq: "always",
    lastmod: new Date(),
  },
  {
    url: "/inquire/case",
    changefreq: "always",
    lastmod: new Date(),
  },
  {
    url: "/baike/list",
    changefreq: "always",
    lastmod: new Date(),
  },
  {
    url: "/news/list",
    changefreq: "always",
    lastmod: new Date(),
  },
];

// 根据参数，获取所有的id  1医院、2医生、3商品、4资讯、5问答、6医院资质、7医生资质、8材料资质、9案例、10百科
export const getSiteMapList = async function (type) {
  let _params = { type: type || 1 };
  let res = await axios.get(config.baseURL + GET_SITEMAP_INFO, {
    params: _params,
  });
  let _obj = res.data || {};
  let arr = _obj.data || [];
  return arr;
};
